import { NativeModules } from 'react-native';
import { isIOS } from '../../constant';

const putBoolean = (key: string, value: boolean, name: string): void => {
  NativeModules.ConstantModule.putBoolean(key, value, name);
};

const putString = (key: string, value: string, name: string): void => {
  NativeModules.ConstantModule.putString(key, value, name);
};

const putInt = (key: string, value: number, name: string): void => {
  NativeModules.ConstantModule.putInt(key, value, name);
};

const setKey = (key: string, value: string, name: string): void => {
  if (!isIOS) return;
  NativeModules.ConstantModule.setKey(key, value, name);
};

const getValueWithKey = (key: string, name: string): string => {
  if (!isIOS) return '';
  return NativeModules.ConstantModule.getValueWithKey(key, name);
};

export default {
  putBoolean,
  putString,
  putInt,
  setKey,
  getValueWithKey
};
